const gulp = require('gulp')
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');



gulp.task('minifyjs', function() {
  return gulp.src('src/js/*.js') //操作的源文件
    .pipe(concat('built.js')) //合并到临时文件     
    .pipe(gulp.dest('dist/js')) //生成到目标文件夹
    .pipe(rename({ suffix: '.min' })) //重命名  
    .pipe(uglify()) //压缩
    .pipe(gulp.dest('dist/js'));
});

gulp.task('default', ['minifyjs']);